<?php defined('_JEXEC') or die('Restricted access'); ?>
<form action="index.php" method="post" name="adminForm" 
      enctype="multipart/form-data">

<div id="com_docario">
    <?php if ($this->msg) { ?>
        <div class="msg">
            <?php echo $this->msg; ?>
        </div>
    <?php } ?>
    <div id="col100" class="left">
        <table cellspacing="0" cellpading="0" border="0" width="100%">
            <tr><td valign="top">
                <fieldset class="adminForm" width="100%">
                    <legend><?php echo JText::_('FILE_DATA'); ?></legend>
                    <table class="adminForm"><tbody>
                        <tr>
                            <td width="100">
                                <legend for="file_name">
                                    <?php echo JText::_('FILE_NAME'); ?>
                                </legend>
                            </td>
                            <td>
                                <input type="text" name="file_name" id="file_name"
                                       value="<?php echo $this->file->name; ?>" />
                            </td>
                        </tr>
                        <tr>
                            <td width="100">
                                <legend for="file_alias">
                                    <?php echo JText::_('FILE_ALIAS'); ?>
                                </legend>
                            </td>
                            <td>
                                <input type="text" name="file_alias" 
                                       id="file_alias"
                                       value="<?php echo $this->file->alias; ?>" />
                            </td>
                        </tr>
                        <tr>
                            <td width="100">
                                <legend for="file_userid">
                                    <?php echo JText::_('FILE_USER'); ?>
                                </legend>
                            </td>
                            <td>
                                <?php echo $this->owner->username; ?>
                            </td>
                        </tr>
                        <tr>
                            <td width="100">
                                <legend for="file_catid">
                                    <?php echo JText::_('FILE_CATEGORY'); ?>
                                </legend>
                            </td>
                            <td>
                                <select name="file_catid">
                                    <?php foreach ($this->categories as $category) { ?>
                                        <option value="<?php echo $category->id; ?>" 
                                            <?php echo (($category->id==$this->catid)?'selected="selected"':''); ?>>
                                            <?php echo $category->name; ?>
                                        </option>
                                    <?php } ?>
                                </select>
                            </td>
                        </tr>
                    </tbody></table>
                    <div class="file_editor">
                        <?php
                            $editor = JFactory::getEditor();
                            $params = array(
                                'smilies' => '0',
                                'style' => '1',
                                'layer' => '0',
                                'table' => '0',
                                'clear_entities' => '0'
                            );
                            echo $editor->display('file_description', '',
                                                  '400', '400', '20', '20', false,
                                                  $params);
                        ?>
                    </div>
                </fieldset>
            </td></tr>
        </table>
    </div>
    <div id="col010" class="right">
        <table cellspacing="0" cellpading="0" border="0" width="100%"><tr><td>
            <fieldset class="adminForm" width="100%">
                <legend><?php echo JText::_('FILE_PROPERTIES'); ?></legend>
                <div class="fileproperties <?php echo $this->file_tmp->mime_type; ?>">
                    <legend><?php echo JText::_('FILENAME'); ?></legend>
                    <?php echo $this->file_tmp->name; ?><br />
                    <legend><?php echo JText::_('FILESIZE'); ?></legend>
                    <?php
                        if (isset($this->file_tmp->size))
                            $size = simplifySize($this->file_tmp->size);
                        else $size = simplifySize($this->file->file_size);
                        echo $size; 
                    ?><br />
                    <legend><?php echo JText::_('FILETYPE'); ?></legend>
                    <?php echo $this->file_tmp->mime_type; ?><br />
                </div>
                <legend><?php echo JText::_('FILE_REVISIONS'); ?></legend>
                <div class="filerevisions">
                    
                </div>
            </td></tr></fieldset>
        </table>
    </div>
    <div id="col010" class="right">
        <table cellspacing="0" cellpading="0" width="100%"><tr><td>
            <fieldset class="adminForm" width="100%">
                <legend><?php echo JText::_('FILE_PERMISSIONS'); ?></legend>
                <div class="filepermissions">
                    <legend><?php echo JText::_('USER_PERMISSIONS'); ?></legend>
                    <div class="searchbox">
                        <label for="search"><?php echo JText::_('SEARCH'); ?></label>
                        <input type="text" name="search" id="search" value="" />
                    </div>
                    <table width="100%">
                        <thead>
                            <tr>
                                <th><?php echo JText::_('USER'); ?></th>
                                <th width="120"><?php echo JText::_('READ'); ?></th>
                                <th width="120"><?php echo JText::_('WRITE'); ?></th>
                            </tr>
                        </thead>
                        <tbody id="userscontent">
                        <?php if ($this->file->id > 0) {
                            foreach ($this->file_users as $user) { ?>
                                <tr class="row<?php echo $k; ?>">
                                    <td class="name"><?php echo $user->name; ?></td>
                                    <td class="perm"><div class="<?php echo $user->css_read; ?>" id="cur<?php echo $user->id; ?>">
                                        <select name="ureadselect" class="urs" id="urs<?php echo $user->id; ?>">
                                            <option value="0" <?php echo (($user->read == 0)?'selected="selected"':''); ?>><?php echo JText::_('INHERITED'); ?></option>
                                            <option value="1" <?php echo (($user->read == 1)?'selected="selected"':''); ?>><?php echo JText::_('YES'); ?></option>
                                            <option value="2" <?php echo (($user->read == 2)?'selected="selected"':''); ?>><?php echo JText::_('NO'); ?></option>
                                        </select>
                                    </div></td>
                                    <td class="perm"><div class="<?php echo $user->css_write; ?>" id="cuw<?php echo $user->id; ?>">
                                        <select name="uwriteselect" class="uws" id="uws<?php echo $user->id; ?>">
                                            <option value="0" <?php echo (($user->write == 0)?'selected="selected"':''); ?>><?php echo JText::_('INHERITED'); ?></option>
                                            <option value="1" <?php echo (($user->write == 1)?'selected="selected"':''); ?>><?php echo JText::_('YES'); ?></option>
                                            <option value="2" <?php echo (($user->write == 2)?'selected="selected"':''); ?>><?php echo JText::_('NO'); ?></option>
                                        </select>
                                    </div></td>
                                </tr>
                            <?php }
                        } ?>
                        </tbody>
                    </table>
                </div>
            </fieldset>
        </td></tr></table>
    </div>
</div>
<div class="clear"></div>

<input type="hidden" name="catid" id="catid" 
       value="<?php echo $this->category->id; ?>" />
<input type="hidden" name="id" id="id" value="<?php echo $this->file->id; ?>" />
<input type="hidden" name="file_tmp_id" id="file_tmp_id" value="<?php
    if (!$this->_file) echo -1;
    else echo $this->_file->id;
?>" />
<input type="hidden" name="download_filename" id="download_filename"
    value="<?php echo $this->download_filename; ?>" />
<input type="hidden" name="mime_type" id="mime_type"
    value="<?php echo $this->mime_type; ?>" />

<input type="hidden" name="option" id="option" value="com_docario" />
<input type="hidden" name="controller" id="controller" value="file" />
<input type="hidden" name="task" id="task" value="" />
<input type="hidden" name="baseurl" id="baseurl" value="<?php echo JURI::base(); ?>" />

</form>
